/*
 *接口系统地址。
*/

/*舆情接口地址*/
//var Alpe_ApiUrl='http://dz.qingbao.dzwww.com/yqgz/syj/api3.php?';
var Alpe_ApiUrl='http://sdpost.sddzinfo.com/api4.php?';
// var Alpe_ApiUrl='http://10.17.37.169:8787/api4.php?';


/*
 *登录超时，跳转到登录
 * */
function goto_openWin_loginWin(msg){
	Alpe_setLocalStorge('sys_userID','');
	Alpe_setLocalStorge('access_token','');
	Alpe_setLocalStorge('admin_id','');
	//Alpe_setLocalStorge('username','');
	//Alpe_setLocalStorge('password','');
	if(''==msg||null==msg||undefined==msg){
		api.alert({title:'系统提示',msg:'登录超时，请重新登录'});
	}else{
		api.alert({title:'系统提示',msg:msg});
	}
 	var delay = 0;
 	if("ios" != api.systemType){
    	delay = 300;
  	}
	api.openWin({
        name: 'login',
        url: '../html/login.html',
        bounces: false,
        reload: true,
        rect: {
            x: 0,
            y: 0,
            w: 'auto',
            h: 'auto'
        },
        delay: delay
	});
}

/*
 * 本地存储函数的封装
 */
function Alpe_getLocalStorge(lsKey){
	var item = localStorage.getItem(lsKey);
	if(item=='' || item==null || typeof(item)=="undefined"){
		return '';
	}else{
		return item;
	}
}

/*
 * 本地存储函数的封装
 */
function Alpe_setLocalStorge(lsKey,lsValue){
	var item = localStorage.getItem(lsKey);
	if(item=='' || item==null || typeof(item)=="undefined"){
		localStorage.setItem(lsKey,lsValue);
	}else{
		localStorage.removeItem(lsKey);
		localStorage.setItem(lsKey,lsValue);
	}
	return true;
}


function get_length(s){
		 var char_length = 0;
		 for (var i = 0; i < s.length; i++){
				 var son_char = s.charAt(i);
				 encodeURI(son_char).length > 2 ? char_length += 1 : char_length += 0.5;
		 }
		 return char_length;
 }
